package api;

import java.util.HashSet;

/**
 * @program: baseModule
 * @description:
 * @author: zhanghz001
 * @create: 2020-10-23 14:06
 **/
public class HashSet1 {
    public static void main(String[] args) {
        //hash set 除去元素的原理
        HashSet<People> people = new HashSet<>();
        people.add(new People("name", 11));
        people.add(new People("name", 11));
        people.add(new People("name", 12));
        people.add(new People("name", 13));
        System.out.println(people);
        //  hashcode 可以理解要,这个才是判断是否相等的原因
        //需要在TreeSet中才有用吧, equals也理解要,如果没有重写hashCode会怎么样呢
    }
}
